
<fieldset id="info_edit"><legend>批量包</legend>
<form id="form_add">
<input type="hidden" name="oper" value="{[$smarty.session.id]}" />
<input type="hidden" name="id" value="" />
<table>
	<tr>
		<td width="20%" align="right">流水号：</td>
		<td width="30%">{[$result.id]}（{[$result.oper_t]}）</td>
		<td width="20%" align="right">状态：</td>
		<td width="30%">{[$result.status_t]}</td>
	</tr>
	<tr>
		<td align="right">负责人：</td>
		<td>{[$result.emp_t]}</td>
		<td align="right">日期：</td>
		<td>{[$result.date]}</td>
	</tr>
	<tr>
		<td align="right">名称：</td>
		<td colspan="3">{[$result.name]}</td>
	</tr>
	<tr>
		<td align="right">备注：</td>
		<td colspan="3">{[$result.content]}</td>
	</tr>
	<tr>
		<td align="right">创建时间：</td>
		<td>{[$result.createtime]}</td>
		<td align="right">更新时间：</td>
		<td>{[$result.modifytime]}</td>
	</tr>
</table>
</form>
</fieldset>

<fieldset id="info_edit"><legend>导入数据</legend>
<table>
	<tr>
		<td align="right">类型：</td>
		<td colspan="3"><select name='type' id='type'>
			{[html_options options=$data_option selected=1]}
		</select></td>
	</tr>
	<tr>
		<td align="right">附件：</td>
		<td colspan="3"><input type="file" name="userfile" id="userfile" size="42" value=""></td>
	</tr>
</table>
</fieldset>

<script type="text/javascript">
$(function() {

	$("#userfile").uploadify({
		'swf'       : '/js/uploadify/uploadify.swf',
		'uploader' : 'finance.php?do=SalaryFile.ajax_import',
				
		'buttonText': '请选择文件',
		
		'width'          : 130,
		'queueSizeLimit' : 1,
		'auto': false,
		'multi'          : true,
		'debug': false,
		'removeTimeout': 0.5,
		
		'fileTypeExts'		 : '*.txt;*.csv;*.xls;',
		'fileTypeDesc': 'All Files',
		'fileSizeLimit'		 : '10MB',
		'formData': {
			'id':	'{[$smarty.request.id]}',
			'oper':	'{[$smarty.session.id]}'
		},
		
		'onUploadStart':function(file) {
			
			$("#userfile").uploadify("settings", "formData", {
				'type': $('#type').val()
            });
        },
		
        'onUploadSuccess':function(file, data, response) {
        	
        	var result = Common.result();
    		$('#dialog_add').dialog('option', 'buttons', {
    			"关闭": function() {
    				$(this).dialog("close");
    			},

    			"提交": function() {
    				if (!confirm("确认是否提交？")) {
    					return false;
    				}
    				
    				var form = $("#form_add")[0];
    				
					var body = { };					
					body.id = form.id.value;
					
					body.data = $.toJSON(salary_data);
    				
					$(this).dialog("close");
					
					var url = 'finance.php?do=SalaryFile.importPost';
					
					$.post(url, body, function(data) {
						$(result).html(data);
					});
    			}
    		});
    		
    		// alert(data);
    		// alert(response);

    		dialog_t(data, '第二步 导入信息', '1000x550', '#dialog_add');
        	
			$('#userfile').uploadify('upload');
		},
		
		'onQueueComplete':function(queueData) {
			
			// $('#dialog_add').dialog('close');
			
			// SalaryFile.dialog_next('finance.php?do=SalaryFile.', '第二步 导入信息', '800x450');
		}
		
	});
});
</script>
